<?php 
require_once '../kelas/record.php';
require_once '../kelas/amankanParam.php';
require_once '../kelas/fungsi.php';
require_once '../kelas/komentar.php';
$dtGet=$objParamAman->getMethod();
$dtPost=$objParamAman->postMethod();
$objFungsi->inisialisasiProses($dtGet['on']);
switch ($dtGet['on']) {
	case 'replyAdmin':

	$data['pesan']=$dtPost['message'];
	$data['judul']=$dtPost['subject'];
	$data['parent']=$dtPost['parent'];
	$data['waktu']=date('Y-m-d H:i:s');
	$data['email']=$dtPost['email'];
	$data['nama']=$dtPost['name'];
	$data['status']="1";
	$objKomentar->create($data);
	$ex=$objKomentar->execute();
	if($ex['success']==false){
		echo $objFungsi->alert($ex['error_msg']);
	}
	else{
		//echo $objFungsi->alert('Terima kasih, komentar Anda akan ditampilkan setelah persetujuan dari Moderator.');
	}
	echo $objFungsi->redirect(BASEURLADMIN.'?v=customer&p=cuscomment');
	break;
	break;
	case 'approve':
	unset($dtGet['on']);
	$objKomentar->update(array('status'=>($dtGet['status']==1)?0:1),$dtGet);
	$objKomentar->execute();
	echo $objFungsi->redirect(BASEURLADMIN.'?v=customer&p=cuscomment');
	break;
	case 'sendNew':
	$data['pesan']=$dtPost['message'];
	$data['judul']=$dtPost['subject'];
	$data['parent']=$dtPost['parent'];
	$data['waktu']=date('Y-m-d H:i:s');
	$data['email']=$dtPost['email'];
	$data['nama']=$dtPost['name'];
	$data['status']="0";
	$objKomentar->create($data);
	$ex=$objKomentar->execute();
	if($ex['success']==false){
		echo $objFungsi->alert($ex['error_msg']);
	}
	else{
		echo $objFungsi->alert('Terima kasih, komentar Anda akan ditampilkan setelah persetujuan dari Moderator.');
	}
	echo $objFungsi->redirect(BASEURL.'?v=contact');
	break;
	
	default:
		# code...
	break;
}
?>